package com.wondertek.poms.dao.repo;

import com.wondertek.poms.dao.po.ProductGroup;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface IProductGroupDao extends JpaRepository<ProductGroup,Long> {

    @Query(value="select GROUP_ID from PRODUCT_GROUP where GROUP_ID like ?1", nativeQuery = true)
    List<Long> getAllGroupIdLike(String groupId);

    @Query(value="select GROUP_ID from PRODUCT_GROUP", nativeQuery = true)
    List<Long> getAllGroupId();

    @Query(value="select GROUP_NAME from PRODUCT_GROUP where GROUP_NAME like ?1", nativeQuery = true)
    List<String> getAllGroupNameLike(String groupId);

    @Query(value="select GROUP_NAME from PRODUCT_GROUP", nativeQuery = true)
    List<String> getAllGroupName();

    ProductGroup findByGroupId(Long id);

    @Query(value="select * from PRODUCT_GROUP where GROUP_ID = ?1 and STATUS = 0", nativeQuery = true)
    ProductGroup findValidByGroupId(Long id);
}
